import Https from '@/utils/https'

// 获取目录列表
const getTree = (params) => Https.get('/api/v1/offlineDev/dir/tree', params, { needCode: true })
// 保存目录
const saveDir = (params) => Https.post('/api/v1/offlineDev/dir/save', params, { json: false })
// 保存工作流
const saveTaskFlow = (params) => Https.post('/api/v1/offlineDev/taskFlow/save', params, { needCode: true, json: false })
// 获取工作流详情
const detailTaskFlow = (params) => Https.get('/api/v1/offlineDev/taskFlow/detail', params, { needCode: true })
// 保存节点
const saveNode = (params) => Https.post('/api/v1/offlineDev/taskFlow/node/save', params, { needCode: true, json: false })
// 保存所有节点
const saveCoord = (params) => Https.post('/api/v1/offlineDev/node/saveCoord', params, { needCode: true, json: true })

const toolList = (params) => Https.get('/api/v1/offlineDev/taskflow/toolList', params, { needCode: true })

// 保存关系
const saveRelation = (params) => Https.post('/api/v1/offlineDev/taskFlow/node/relation/save', params, { needCode: true, json: false })

// 删除关系
const deleteRelation = (params) => Https.post('/api/v1/offlineDev/taskFlow/node/relation/delete', params, { needCode: true, json: false })
// taskLog
const taskLog = (params) => Https.get('/api/v1/offlineDev/task/log', params, { needCode: true })
// 停止任务
const stopTask = (params) => Https.post('/api/v1/offlineDev/task/stop', params, { needCode: true, json: false })
// 启动任务
const startFlowTask = (params) => Https.post('/api/v1/offlineDev/flow/task/start', params, { needCode: true, json: false })
// 获取工作流状态
const flowTaskStatus = (params) => Https.get('/api/v1/offlineDev/taskFlow/status', params, { needCode: true })
// 设置工作流的状态
const setScheduleStatus = (params) => Https.post('/api/v1/offlineDev/taskFlow/setScheduleStatus', params, { needCode: true, json: false })
// 获取节点详情
const queryDetailReq = (params) => Https.get('/api/v1/offlineDev/taskFlow/node/detail', params)

// 获取操作记录
const queryHistoryReq = (params) => Https.get('/api/v1/offlineDev/task/operation/history', params, { needCode: true })

// 工作流保存调度配置
const querySaveScheduleReq = (params) => Https.post('/api/v1/offlineDev/taskFlow/vNode/config/saveSchedule', params, { needCode: true })

// 工作流获取虚节点详情（开始节点）
const queryVNodeDetailReq = (params) => Https.get('/api/v1/offlineDev/taskFlow/vNode/detail', params)

// 创建任务
const saveTask = (params) => Https.post('/api/v1/offlineDev/task/save', params)

// 移动节点获取选项树
const taskflowTree = (params) => Https.get('/api/v1/offlineDev/taskflow/node/tree', params)

// 移动节点至其他目录
const changeDir = (params) => Https.post('/api/v1/offlineDev/dir/change', params, { json: false })

export {
  setScheduleStatus, flowTaskStatus, startFlowTask, stopTask, taskLog, getTree, saveDir, saveTaskFlow, queryDetailReq, 
  queryHistoryReq, detailTaskFlow, saveNode, saveRelation, deleteRelation, saveTask, querySaveScheduleReq, saveCoord,
  queryVNodeDetailReq, changeDir, taskflowTree, toolList,
}
